<template>
  <basic-container class="box-shadow">
    <dataList :pageInfo="pager" placeholder="请输入物业名称" :listData="tableData" searchName="propertyName" :filterList="filterList" :menuList="[]">
      <el-table :data="tableData" style="width: 100%">
        <el-table-column label="物业类型" :formatter="dictVal_propertyTypes" prop="projectType"></el-table-column>
        <el-table-column label="物业名称" prop="propertyName" />
        <el-table-column label="物业地址" prop="projectAddr" />
        <el-table-column label="具体位置" prop="address" />
        <el-table-column label="巡查人" prop="inspectionPerson" />
        <el-table-column label="实际巡查日期" prop="inspectionDate" />
        <el-table-column label="巡查结果" prop="inspectionResult">
          <template slot-scope="scope">
            <span v-if="scope.row.inspectionResult == 0">达标</span>
            <span v-else>未达标</span>
          </template>
        </el-table-column>
        <el-table-column label="管理所" prop="manageUnit" :formatter="manageFormatter"></el-table-column>

        <el-table-column label="备注" prop="remarks"></el-table-column>
        <el-table-column width="125px" label="操作">
          <template slot-scope="scope">
            <el-link
              type="primary"
              :underline="false"
              @click="
                                showDetailsOfInspectionResults(
                                    'view',
                                    scope.row
                                )
                            "
            >查看</el-link>
          </template>
        </el-table-column>
      </el-table>
    </dataList>

    <el-dialog :title="title" :visible.sync="dialogTableVisible" :close-on-click-modal="false" width="80%" @close="close">
      <div style="font-weight: 700; height: 40px; font-size: 16px;">基本信息</div>
      <el-form ref="resultDetailsForm" :model="resultDetailsForm" label-width="auto">
        <el-row type="flex" class="row-bg" justify="space-between" :gutter="20">
          <el-col :span="6">
            <el-form-item label="物业名称" prop="propertyName">
              <el-input v-model="resultDetailsForm.propertyName" readonly="readonly"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="物业地址" prop="projectAddr">
              <el-input v-model="resultDetailsForm.projectAddr" readonly="readonly"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="具体位置" prop="address">
              <el-input v-model="resultDetailsForm.address" readonly="readonly"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="使用单位" prop="useUnit">
              <el-input v-model="resultDetailsForm.useUnit" readonly="readonly"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg" justify="space-between" :gutter="10">
          <el-col :span="6">
            <el-form-item label="联系电话" prop="mobile">
              <el-input v-model="resultDetailsForm.mobile" readonly="readonly"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6" style="overflow: hidden;">
            <el-form-item label="预计巡查日期" prop="predictInspectionDate">
              <el-input
                v-model="
                                    resultDetailsForm.predictInspectionDate
                                "
                readonly="readonly"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6" style="overflow: hidden;">
            <el-form-item label="实际巡查日期" prop="inspectionDate">
              <el-input v-model="resultDetailsForm.inspectionDate" readonly="readonly"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="所属管理所" prop="manageUnit">
              <span v-for="item in manageUnits" :key="item.value">
                <span v-if="resultDetailsForm.manageUnit == item.value">{{ item.label }}</span>
              </span>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex" class="row-bg" justify="space-between" :gutter="20">
          <el-col :span="6">
            <el-form-item label="巡查人员" prop="inspectionPerson">
              <el-input v-model="resultDetailsForm.inspectionPerson" readonly="readonly"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="巡查结果" prop="inspectionResult">
              <el-input
                :value="
                                    resultDetailsForm.inspectionResult == '0'
                                        ? '达标'
                                        : '未达标'
                                "
                readonly="readonly"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6"></el-col>
          <el-col :span="6"></el-col>
        </el-row>
        <el-row type="flex" class="row-bg" justify="space-between">
          <el-col :span="16">
            <el-form-item label="备注">
              <el-input v-model="resultDetailsForm.remarks" readonly="readonly"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item></el-form-item>
      </el-form>
      <el-tabs v-model="tabTitle">
        <el-tab-pane label="上报隐患记录" name="上报隐患记录">
          <el-table
            :data="resultDetailsForm.reportDangerRecord"
            :header-cell-style="{
                            'text-align': ' center'
                        }"
          >
            <el-table-column property="inspectionName" align="center" label="检查项目"></el-table-column>
            <el-table-column property="inspectionStandard" align="center" label="检查标准"></el-table-column>
            <el-table-column property="inspectResult" align="center" label="检查结果">
              <template slot-scope="scope">
                <span
                  v-text="
                                        scope.row.inspectResult == '0'
                                            ? '达标'
                                            : '未达标'
                                    "
                ></span>
              </template>
            </el-table-column>
            <el-table-column property="substandardContents" align="center" label="补充说明">
              <template slot-scope="scope">
                <el-input v-model="scope.row.substandardContents" readonly="readonly" style="text-align: center;"></el-input>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
      </el-tabs>

      <h3 style="margin-top: 20px;">附件</h3>
      <el-divider></el-divider>
      <div v-if="dialogTableVisible">
        <upload-media
          type="file"
          ref="upload"
          :busId="resultDetailsForm.resultId"
          modelType="checkin"
          :propsFileList="uploadFileList"
          isShowFileList
          :isView="title === '查看巡查结果'"
        />
      </div>
      <div style="width: 100% ; overflow: hidden;">
        <div style="float: right;">
          <el-button @click="dialogTableVisible = false">返回</el-button>
        </div>
      </div>
    </el-dialog>
  </basic-container>
</template>
<script src="./index.js"></script>
<style lang="scss" scoped>
.fl {
  float: left;
}

.fr {
  float: right;
}
.footer {
  overflow: hidden;
}

.header {
  overflow: hidden;
  margin-bottom: 10px;

  .fl {
    width: 60%;
  }
}
</style>
